<template>
	<view class="cover">
		<image :src="url" mode="widthFix" @longpress="oper"></image>
	</view> 
</template>

<script>
	export default{
		data(){
			return {
				url:''
			}
		},
		onLoad(e){
			// console.log(e)
			this.url=e.url
			
		},
		methods:{
			oper(){
				var that=this
				uni.showActionSheet({
					itemList:['下载','看看','你说了算'],
					success:function(e){
						console.log(e.tapIndex)
					if(e.tapIndex==0){
						uni.downloadFile({ 
							url:that.url,
							success:function(res){
								// console.log(res.tempFilePath)  //获取 临时路径
								uni.saveImageToPhotosAlbum({
									filePath:res.tempFilePath,
									success:function(){
										uni.showToast({
											title:"下载成功",
											duration:1500
										})
									}
								})
							}
						})
					}else{
					uni.showToast({
						title:"都说了，你自己解决",
						duration:2000
					})
					}
					}
					
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.cover{
		width: 100vw;
		height: 100vh;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>
